<?php

namespace App\Http\Controllers\Home;

use App\Http\Model\Article;
use App\Http\Model\Navs;
use Illuminate\Http\Request;

use App\Http\Requests;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\View;

class CommonController extends Controller
{
	public function __construct()
	{
		//点击量最高的6篇文章
		$hottest = Article::orderBy('article_view', 'desc')->take(6)->get();

		//最新发布的8篇文章
		$new = Article::orderBy('article_time', 'desc')->take(8)->get();

		$navs = Navs::all();

		View::share('hottest', $hottest);
		View::share('new', $new);
		View::share('navs', $navs);
    }
}
